package com.yanqu.road.server.cmd.activity.seacraftsouthsea;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.AutoSendRewardProto;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.activity.seacraftsouthsea.SeacraftSouthSeaMgr;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import com.yanqu.road.utils.YanQuMessageUtils;

/**
 * @Description
 * @Author cwq
 * @Data 2022/1/20 17:21
 */
@Cmd(code = CrossProtocol.C2_SEACRAFT_SOUTH_SEA_CROSS_AUTO_SEND_UNION_RANK_LIST, desc = "海上争霸 南海丝路 自动发奖获取商会排名列表")
public class CrossSeacraftSouthSeaCmd extends CrossUnionCommand {

    int activityId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        AutoSendRewardProto.NoticeCrossUserRankMsg reqMsg = AutoSendRewardProto.NoticeCrossUserRankMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        YanQuMessage message = YanQuMessageUtils.buildMessage(GameProtocol.S_SEACRAFT_SOUTH_SEA_AUTO_SEND_RANK_FROM_CROSS, SeacraftSouthSeaMgr.autoSendUnionRankList(activityId));
        MessageHelper.sendPacket(serverId, 0, message);
    }

    @Override
    public void sendData() {

    }
}
